package com.chen.recruit.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chen.recruit.domain.dto.ClassroomDto;
import com.chen.recruit.domain.model.PageQuery;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.chen.recruit.domain.vo.ClassroomVo;
import com.chen.recruit.domain.Classroom;
import com.chen.recruit.mapper.ClassroomMapper;
import com.chen.recruit.service.ClassroomService;

import java.util.Objects;

/**
 * 教室Service业务层处理
 *
 * @author cgy
 * @date 2022-08-20
 */
@Service
public class ClassroomServiceImpl extends ServiceImpl<ClassroomMapper, Classroom> implements ClassroomService {

    @Override
    public Page<ClassroomDto> queryPageList(ClassroomVo vo, PageQuery pageQuery) {
        return null;
    }


    private LambdaQueryWrapper<Classroom> buildQueryWrapper(ClassroomVo vo) {
        return Wrappers.<Classroom>lambdaQuery()
                .like(StringUtils.isNotBlank(vo.getName()), Classroom::getName, vo.getName())
                .like(StringUtils.isNotBlank(vo.getPlace()), Classroom::getPlace, vo.getPlace())
                .eq(ObjectUtil.isNotNull(vo.getStatus()), Classroom::getStatus, vo.getStatus())
                .eq(Objects.nonNull(vo.getCollegeId()), Classroom::getCollegeId, vo.getCollegeId());
    }

}
